<?
//统计符合条件的项的ping

//table:表格
//$item:要统计的项
//condition:搜索条件
//不填写conditon则表示直接获取表格数据数目

function  count_avg($table,$item,$condition)
{

if($condition)	
{
$condition="where $condition";
}
else
{
$condition="";	
}


$sqlstr="select AVG($item) from $table $condition";

$values = mysql_result(mysql_query($sqlstr), 0);

mysql_close($con);

return $values ;

 }



?>
